package Solution;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-03-09
 * Time: 22:05
 */
//https://www.nowcoder.com/questionTerminal/f88dafac00c8431fa363cd85a37c2d5e
public class Solution1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String source = scanner.nextLine().toUpperCase();
        String now = scanner.nextLine().toUpperCase();
        boolean[] judge = new boolean[128];
        int sl = source.length();
        int ns = now.length();
        for (int i = 0; i < ns; i++) {
            judge[now.charAt(i) - '0'] = true;
        }
        for (int i = 0; i < sl; i++) {
            if (!judge[source.charAt(i) - '0']) {
                judge[source.charAt(i) - '0'] = true;
                System.out.print(source.charAt(i));
            }
        }

    }
}
